#!/bin/bash

: ${runtime:=30}

jobfile=fio_vm_${ioengine}_${blocksize}
[ "${jobfile#*__}" != "$jobfile" ] && {
    echo "error composing $jobfile: missing options" >&2
    exit 1
}

cat > $jobfile <<EOF
[global]
runtime=$runtime
direct=1
blocksize=$blocksize
filename=$filename
group_reporting
size=$size

[seq-read]
rw=read
ioengine=psync 
blocksize=1024k
stonewall

[rand-read]
rw=randread
ioengine=libaio
blocksize=4k
iodepth=32
thread
stonewall

[seq-write]
rw=write
ioengine=psync
blocksize=1024k
stonewall

[rand-write]
rw=randwrite
ioengine=libaio
blocksize=4k
iodepth=32
thread
stonewall
EOF
